package com.zz.bsea.config;


import com.jfinal.kit.PropKit;
import com.jfinal.weixin.sdk.api.SnsAccessTokenApi;

public class OpenIdDemoController extends SubscribeMsgController {
	public void index(){
			String authorizeURL = SnsAccessTokenApi.getAuthorizeURL(PropKit.get("appId"),
					"http://1834578c.ngrok.io/openiddemo/showUser",false);
			System.out.println(authorizeURL);
			redirect(authorizeURL);
		
	}
	
	public void showUser() {
		String code=getPara("code");
		String openid=SnsAccessTokenApi.getSnsAccessToken(PropKit.get("appId"), PropKit.get("appSecret"), code).getOpenid();
		System.out.println("open id------"+openid);
		render("login.html");
	}
}
